﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TPCN.DAL;

namespace TPCN.Controls
{
    public partial class uc_shoppingcart : System.Web.UI.UserControl
    {
        private static ShoppingCartObj cart = new ShoppingCartObj();

        protected void Page_Load(object sender, EventArgs e)
        {
            LoadData();
            if (HttpContext.Current.Session["user"] != null)
                orderstatus.Visible = true;
            else
                orderstatus.Visible = false;
        }

        protected void LoadData()
        {
            if (HttpContext.Current.Session["cart"] != null)
            {
                cart = (ShoppingCartObj)HttpContext.Current.Session["cart"];
                //int i = (int)"1"
                if (!String.IsNullOrEmpty(cart.Tongtien))
                {
                    lblTongtien.Text = cart.Tongtien;
                }
                lblCount.Text = cart.Count().ToString();
            }
            else
            {
                lblCount.Text = "0";
                lblTongtien.Text = "0";
            }
        }
    }
}